%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/interfaces-single-table/nested-more-fragments"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 6, 8, 9, 10<br />2: PgSelect[7]<br />3: PgSelectRows[11]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 10, 6<br /><br />ROOT __Item{1}ᐸ11ᐳ[12]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 13, 10, 6<br /><br />ROOT PgSelectSingle{1}ᐸpeopleᐳ[13]<br />1: <br />ᐳ: 14, 15<br />2: PgSelect[16]<br />3: PgSelectRows[20]"):::bucket
    Bucket3("Bucket 3 (listItem)<br />Deps: 10<br /><br />ROOT __Item{3}ᐸ20ᐳ[21]<br />1: <br />ᐳ: 22, 23, 25, 26, 27, 77, 82, 112, 117, 122, 127, 132<br />2: PgSelect[28], PgSelect[83]<br />3: PgSelectRows[33], PgSelectRows[86]<br />ᐳ: 32, 34, 85, 87, 147, 148, 160, 165, 205, 210, 215, 220, 225<br />4: PgSelect[166]<br />5: PgSelectRows[171]<br />ᐳ: First[170], PgSelectSingle[172]"):::bucket
    Bucket4("Bucket 4 (polymorphic)<br />__typename: Lambda[26]<br />Deps: 22, 26, 87, 34, 148, 172, 23, 25, 77, 112, 117, 122, 127, 132, 27, 147, 160, 205, 210, 215, 220, 225"):::bucket
    Bucket5("Bucket 5 (nullableBoundary)<br />Deps: 87<br /><br />ROOT PgSelectSingle{3}ᐸpeopleᐳ[87]"):::bucket
    Bucket6("Bucket 6 (polymorphic)<br />__typename: Lambda[148]<br />Deps: 34, 148, 172, 27, 147, 160, 205, 210, 215, 220, 225"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 172<br /><br />ROOT PgSelectSingle{3}ᐸpeopleᐳ[172]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket5 & Bucket6
    Bucket6 --> Bucket7

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸpeopleᐳ<br />More deps:<br />- Object[10]<br />- Constantᐸundefinedᐳ[6]"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 5"}}:::plan
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    PgSelectRows11[["PgSelectRows[11∈0] ➊"]]:::plan
    PgSelect7 --> PgSelectRows11
    __Item12[/"__Item[12∈1]<br />ᐸ11ᐳ"\]:::itemplan
    PgSelectRows11 ==> __Item12
    PgSelectSingle13{{"PgSelectSingle[13∈1]<br />ᐸpeopleᐳ"}}:::plan
    __Item12 --> PgSelectSingle13
    PgSelect16[["PgSelect[16∈2]<br />ᐸsingle_table_itemsᐳ<br />More deps:<br />- Object[10]<br />- Constantᐸundefinedᐳ[6]<br />- Constantᐸundefinedᐳ[6]"]]:::plan
    PgClassExpression15{{"PgClassExpression[15∈2]<br />ᐸ__people__.”person_id”ᐳ"}}:::plan
    PgClassExpression15 --> PgSelect16
    PgClassExpression14{{"PgClassExpression[14∈2]<br />ᐸ__people__.”username”ᐳ"}}:::plan
    PgSelectSingle13 --> PgClassExpression14
    PgSelectSingle13 --> PgClassExpression15
    PgSelectRows20[["PgSelectRows[20∈2]"]]:::plan
    PgSelect16 --> PgSelectRows20
    PgSelect28[["PgSelect[28∈3]<br />ᐸsingle_table_itemsᐳ<br />More deps:<br />- Object[10]"]]:::plan
    PgClassExpression27{{"PgClassExpression[27∈3]<br />ᐸ__single_t...parent_id”ᐳ"}}:::plan
    PgClassExpression27 --> PgSelect28
    PgSelect83[["PgSelect[83∈3]<br />ᐸpeopleᐳ<br />More deps:<br />- Object[10]"]]:::plan
    PgClassExpression82{{"PgClassExpression[82∈3]<br />ᐸ__single_t...author_id”ᐳ"}}:::plan
    PgClassExpression82 --> PgSelect83
    PgSelect166[["PgSelect[166∈3]<br />ᐸpeopleᐳ<br />More deps:<br />- Object[10]"]]:::plan
    PgClassExpression165{{"PgClassExpression[165∈3]<br />ᐸ__single_t...author_id”ᐳ"}}:::plan
    PgClassExpression165 --> PgSelect166
    __Item21[/"__Item[21∈3]<br />ᐸ20ᐳ"\]:::itemplan
    PgSelectRows20 ==> __Item21
    PgSelectSingle22{{"PgSelectSingle[22∈3]<br />ᐸsingle_table_itemsᐳ"}}:::plan
    __Item21 --> PgSelectSingle22
    PgClassExpression23{{"PgClassExpression[23∈3]<br />ᐸ__single_t...ems__.”id”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression23
    PgClassExpression25{{"PgClassExpression[25∈3]<br />ᐸ__single_t...s__.”type”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression25
    Lambda26{{"Lambda[26∈3]"}}:::plan
    PgClassExpression25 --> Lambda26
    PgSelectSingle22 --> PgClassExpression27
    First32{{"First[32∈3]"}}:::plan
    PgSelectRows33[["PgSelectRows[33∈3]"]]:::plan
    PgSelectRows33 --> First32
    PgSelect28 --> PgSelectRows33
    PgSelectSingle34{{"PgSelectSingle[34∈3]<br />ᐸsingle_table_itemsᐳ"}}:::plan
    First32 --> PgSelectSingle34
    PgClassExpression77{{"PgClassExpression[77∈3]<br />ᐸ__single_t...__.”type2”ᐳ"}}:::plan
    PgClassExpression23 o--o PgClassExpression77
    PgSelectSingle22 --> PgClassExpression82
    First85{{"First[85∈3]"}}:::plan
    PgSelectRows86[["PgSelectRows[86∈3]"]]:::plan
    PgSelectRows86 --> First85
    PgSelect83 --> PgSelectRows86
    PgSelectSingle87{{"PgSelectSingle[87∈3]<br />ᐸpeopleᐳ"}}:::plan
    First85 --> PgSelectSingle87
    PgClassExpression112{{"PgClassExpression[112∈3]<br />ᐸ__single_t...”position”ᐳ"}}:::plan
    PgClassExpression77 o--o PgClassExpression112
    PgClassExpression117{{"PgClassExpression[117∈3]<br />ᐸ__single_t...reated_at”ᐳ"}}:::plan
    PgClassExpression112 o--o PgClassExpression117
    PgClassExpression122{{"PgClassExpression[122∈3]<br />ᐸ__single_t...pdated_at”ᐳ"}}:::plan
    PgClassExpression117 o--o PgClassExpression122
    PgClassExpression127{{"PgClassExpression[127∈3]<br />ᐸ__single_t..._archived”ᐳ"}}:::plan
    PgClassExpression122 o--o PgClassExpression127
    PgClassExpression132{{"PgClassExpression[132∈3]<br />ᐸ__single_t...chived_at”ᐳ"}}:::plan
    PgClassExpression127 o--o PgClassExpression132
    PgClassExpression147{{"PgClassExpression[147∈3]<br />ᐸ__single_t...s__.”type”ᐳ"}}:::plan
    PgSelectSingle34 --> PgClassExpression147
    Lambda148{{"Lambda[148∈3]"}}:::plan
    PgClassExpression147 --> Lambda148
    PgClassExpression160{{"PgClassExpression[160∈3]<br />ᐸ__single_t...__.”type2”ᐳ"}}:::plan
    PgSelectSingle34 --> PgClassExpression160
    PgSelectSingle34 --> PgClassExpression165
    First170{{"First[170∈3]"}}:::plan
    PgSelectRows171[["PgSelectRows[171∈3]"]]:::plan
    PgSelectRows171 --> First170
    PgSelect166 --> PgSelectRows171
    PgSelectSingle172{{"PgSelectSingle[172∈3]<br />ᐸpeopleᐳ"}}:::plan
    First170 --> PgSelectSingle172
    PgClassExpression205{{"PgClassExpression[205∈3]<br />ᐸ__single_t...”position”ᐳ"}}:::plan
    PgClassExpression160 o--o PgClassExpression205
    PgClassExpression210{{"PgClassExpression[210∈3]<br />ᐸ__single_t...reated_at”ᐳ"}}:::plan
    PgClassExpression205 o--o PgClassExpression210
    PgClassExpression215{{"PgClassExpression[215∈3]<br />ᐸ__single_t...pdated_at”ᐳ"}}:::plan
    PgClassExpression210 o--o PgClassExpression215
    PgClassExpression220{{"PgClassExpression[220∈3]<br />ᐸ__single_t..._archived”ᐳ"}}:::plan
    PgClassExpression215 o--o PgClassExpression220
    PgClassExpression225{{"PgClassExpression[225∈3]<br />ᐸ__single_t...chived_at”ᐳ"}}:::plan
    PgClassExpression220 o--o PgClassExpression225
    PgClassExpression137{{"PgClassExpression[137∈4]<br />ᐸ__single_t...__.”title”ᐳ<br />ᐳSingleTableTopic<br />ᐳSingleTablePost<br />ᐳSingleTableDivider<br />ᐳSingleTableChecklist"}}:::plan
    PgClassExpression132 o--o PgClassExpression137
    PgClassExpression141{{"PgClassExpression[141∈4]<br />ᐸ__single_t...scription”ᐳ<br />ᐳSingleTableChecklistItem<br />ᐳSingleTablePost"}}:::plan
    PgClassExpression137 o--o PgClassExpression141
    PgClassExpression143{{"PgClassExpression[143∈4]<br />ᐸ__single_t...__.”color”ᐳ<br />ᐳSingleTableDivider"}}:::plan
    PgClassExpression141 o--o PgClassExpression143
    PgClassExpression144{{"PgClassExpression[144∈4]<br />ᐸ__single_t...s__.”note”ᐳ<br />ᐳSingleTableChecklistItem<br />ᐳSingleTablePost"}}:::plan
    PgClassExpression143 o--o PgClassExpression144
    PgClassExpression149{{"PgClassExpression[149∈5]<br />ᐸ__people__.”username”ᐳ<br />ᐳSingleTableTopic<br />ᐳSingleTablePost<br />ᐳSingleTableDivider<br />ᐳSingleTableChecklist<br />ᐳSingleTableChecklistItem"}}:::plan
    PgSelectSingle87 --> PgClassExpression149
    PgClassExpression230{{"PgClassExpression[230∈6]<br />ᐸ__single_t...__.”title”ᐳ<br />(5) ...ᐳSingleTableTopic<br />(5) ...ᐳSingleTablePost<br />(5) ...ᐳSingleTableDivider<br />(5) ...ᐳSingleTableChecklist"}}:::plan
    PgClassExpression225 o--o PgClassExpression230
    PgClassExpression234{{"PgClassExpression[234∈6]<br />ᐸ__single_t...scription”ᐳ<br />(5) ...ᐳSingleTableChecklistItem<br />(5) ...ᐳSingleTablePost"}}:::plan
    PgClassExpression230 o--o PgClassExpression234
    PgClassExpression236{{"PgClassExpression[236∈6]<br />ᐸ__single_t...__.”color”ᐳ<br />(5) ...ᐳSingleTableDivider"}}:::plan
    PgClassExpression234 o--o PgClassExpression236
    PgClassExpression237{{"PgClassExpression[237∈6]<br />ᐸ__single_t...s__.”note”ᐳ<br />(5) ...ᐳSingleTableChecklistItem<br />(5) ...ᐳSingleTablePost"}}:::plan
    PgClassExpression236 o--o PgClassExpression237
    PgClassExpression239{{"PgClassExpression[239∈7]<br />ᐸ__people__.”username”ᐳ<br />(5) ...ᐳSingleTableTopic<br />(5) ...ᐳSingleTablePost<br />(5) ...ᐳSingleTableDivider<br />(5) ...ᐳSingleTableChecklist<br />(5) ...ᐳSingleTableChecklistItem"}}:::plan
    PgSelectSingle172 --> PgClassExpression239

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,PgSelectRows11 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item12,PgSelectSingle13 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression14,PgClassExpression15,PgSelect16,PgSelectRows20 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item21,PgSelectSingle22,PgClassExpression23,PgClassExpression25,Lambda26,PgClassExpression27,PgSelect28,First32,PgSelectRows33,PgSelectSingle34,PgClassExpression77,PgClassExpression82,PgSelect83,First85,PgSelectRows86,PgSelectSingle87,PgClassExpression112,PgClassExpression117,PgClassExpression122,PgClassExpression127,PgClassExpression132,PgClassExpression147,Lambda148,PgClassExpression160,PgClassExpression165,PgSelect166,First170,PgSelectRows171,PgSelectSingle172,PgClassExpression205,PgClassExpression210,PgClassExpression215,PgClassExpression220,PgClassExpression225 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression137,PgClassExpression141,PgClassExpression143,PgClassExpression144 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgClassExpression149 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,PgClassExpression230,PgClassExpression234,PgClassExpression236,PgClassExpression237 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression239 bucket7

